package com.learnyou.server.xingzuo.biz.helper;

import cn.hutool.core.thread.ExecutorBuilder;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author heweifeng
 * @Description:
 * @date 2023/2/20 18:38
 */
public class RsyncHelper {

    private static ExecutorService executor = ExecutorBuilder.create()
            .setCorePoolSize(10)
            .setMaxPoolSize(50)
            .setWorkQueue(new LinkedBlockingQueue<>(50))
            .setHandler(new ThreadPoolExecutor.CallerRunsPolicy())
            .build();

    public static void execute(Runnable runnable) {
        executor.execute(runnable);
    }
}
